package com.sghd.candy.module.skill.manager;

import com.sghd.common.ramcache.anno.Inject;
import com.sghd.common.ramcache.service.EntityCacheService;
import org.springframework.stereotype.Component;

import java.util.Set;

/**
 * @author Allen
 * @date 2018/12/11
 */
@Component
public class SkillConfigManager {
    @Inject
    private EntityCacheService<Integer, SkillConfig> skillCache;

    public SkillConfig getSkillConfig(int skillId) {
       return skillCache.load(skillId);
    }

    public Set find(int rarity) {
        return skillCache.getFinder().find(filter -> {
            if (filter.getRarity() == rarity) {
                return false;
            } else {
                return true;
            }
        });
    }

    public Set all() {
        return skillCache.getFinder().all();
    }
}
